Skip to content

feat(grpc-proxy): expose GET /info endpoint - #610

Merged
priyaselvaganesan merged 1 commit into
mainfrom
feat/version-endpoint-grpc-proxy
Aug 5, 2026
Merged

feat(grpc-proxy): expose GET /info endpoint#610
priyaselvaganesan merged 1 commit into
mainfrom
feat/version-endpoint-grpc-proxy

Conversation

@priyaselvaganesan

@priyaselvaganesan priyaselvaganesan commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Adds GET /info to grpc-proxy. It serves service, version, and commit via go-lib's shared golibversion.Handler().

Additional Details

  • /info's fields come from Service, Version, and GitHash x_defs stamped at build time, added to the existing nvcf-grpc-proxy_lib map alongside proxy.version.
  • GitHash uses {STABLE_GIT_COMMIT_FULL}, a stamp key this PR adds to the shared tools/workspace_status.sh (with a test) for the full commit SHA.
  • /info registers on the http/2 traffic mux next to / and /health (proxy/h2.go, newProxyMux), so it runs through the existing otelhttp metrics, traces, and zap logging like the proxied traffic.
  • Extracts newProxyMux to make the routes unit-testable.
  • go-lib resolves via the root module in the consolidated bazel workspace.

For QA

From the repo root, run bazel build //src/invocation-plane-services/grpc-proxy:image.tar --stamp. The binary embeds nvcf-grpc-proxy (Service), mr-<sha> (Version), and the full 40-char commit SHA. Unit tests cover GET returning 200 JSON and non-GET returning 405 with Allow: GET and an empty body.

Deployed the stamped image to a local k3d cluster and curled the endpoint through the pod:

GET  /info   200  {"service":"nvcf-grpc-proxy","version":"mr-<sha>","commit":"<full-40-char-sha>"}
GET  /health 200
POST /info   405

The commit field matched the deployed commit SHA.

For the Reviewer

Issues

Relates to #315

Dependencies

Adds go-lib v0.0.0-20260728185909-afca4ec2fb26. Go MVS pulls otel and related golang.org/x deps forward as go-lib requires.

Summary by CodeRabbit

  • New Features
    • Added a new /info endpoint that returns service metadata in JSON.
    • The HTTP/2 server now consistently exposes /, /health, and /info.
  • Bug Fixes
    • Improved commit SHA reporting so build and runtime metadata include the full Git commit hash.
  • Tests
    • Added coverage for the /info endpoint and commit hash reporting.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

gRPC proxy version metadata

Layer / File(s) Summary
Build version stamping
tools/workspace_status.sh, tools/scripts/test/test-workspace-status.sh, src/invocation-plane-services/grpc-proxy/BUILD.bazel
The workspace status script emits STABLE_GIT_COMMIT_FULL. Bazel injects the service, version, and full commit values into the version package.
Proxy info endpoint and validation
src/invocation-plane-services/grpc-proxy/proxy/..., src/invocation-plane-services/grpc-proxy/go.mod
The proxy mux serves /info with build metadata. Tests validate GET responses and reject unsupported methods with status 405 and an Allow header. Dependencies and Bazel targets are updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant newProxyMux
  participant golibversion
  Client->>newProxyMux: GET /info
  newProxyMux->>golibversion: Read service, version, and commit metadata
  golibversion-->>newProxyMux: Build version metadata
  newProxyMux-->>Client: JSON response
Loading

Suggested reviewers: balajinvda, apartha-nv, shelleyshen-0

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required Conventional Commits format and accurately describes the new GET /info endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-endpoint-grpc-proxy

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-grpc-proxy branch 3 times, most recently from 96e3c1f to 1e8b8a4 Compare August 5, 2026 15:42
@priyaselvaganesan
priyaselvaganesan marked this pull request as ready for review August 5, 2026 16:12
@priyaselvaganesan
priyaselvaganesan requested review from a team as code owners August 5, 2026 16:12
Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-grpc-proxy branch from 1e8b8a4 to 816fdd0 Compare August 5, 2026 16:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/invocation-plane-services/grpc-proxy/proxy/h2.go (1)

45-46: 📐 Maintainability & Code Quality | 🔵 Trivial

Verify observability coverage for /info.

createHttp2Server applies middleware.ApplyMiddleware to the complete mux. Confirm that this middleware emits structured request logs, an inbound OpenTelemetry span, and RED metrics for /info. Add route-specific instrumentation only if the shared middleware excludes it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/invocation-plane-services/grpc-proxy/proxy/h2.go` around lines 45 - 46,
Verify that the middleware applied to the complete mux in createHttp2Server
provides structured request logging, inbound OpenTelemetry spans, and RED
metrics for the /info route. Only add route-specific instrumentation if the
shared middleware does not cover /info; otherwise leave the existing shared
middleware unchanged.

Sources: Coding guidelines, Path instructions

src/invocation-plane-services/grpc-proxy/proxy/info_test.go (1)

55-65: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Exercise the build-time metadata contract.

The test currently accepts "unknown" as a valid result, so it cannot detect a broken linker mapping. Add one stamped test path that proves the expected service name, release version, and full SHA reach the shared handler.

  • src/invocation-plane-services/grpc-proxy/proxy/info_test.go#L55-L65: replace non-empty checks with assertions against controlled expected values.
  • src/invocation-plane-services/grpc-proxy/BUILD.bazel#L46-L48: connect the test or a binary-level test to the Service, Version, and GitHash x_defs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/invocation-plane-services/grpc-proxy/proxy/info_test.go` around lines 55
- 65, Replace the non-empty checks in the info handler test with assertions for
controlled expected service, version, and full SHA values. In
src/invocation-plane-services/grpc-proxy/proxy/info_test.go:55-65, define or
reuse those expected values and validate each response field exactly. In
src/invocation-plane-services/grpc-proxy/BUILD.bazel:46-48, wire the test or a
binary-level test to the Service, Version, and GitHash x_defs so the stamped
metadata reaches the shared handler.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/invocation-plane-services/grpc-proxy/proxy/h2.go`:
- Around line 45-46: Verify that the middleware applied to the complete mux in
createHttp2Server provides structured request logging, inbound OpenTelemetry
spans, and RED metrics for the /info route. Only add route-specific
instrumentation if the shared middleware does not cover /info; otherwise leave
the existing shared middleware unchanged.

In `@src/invocation-plane-services/grpc-proxy/proxy/info_test.go`:
- Around line 55-65: Replace the non-empty checks in the info handler test with
assertions for controlled expected service, version, and full SHA values. In
src/invocation-plane-services/grpc-proxy/proxy/info_test.go:55-65, define or
reuse those expected values and validate each response field exactly. In
src/invocation-plane-services/grpc-proxy/BUILD.bazel:46-48, wire the test or a
binary-level test to the Service, Version, and GitHash x_defs so the stamped
metadata reaches the shared handler.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ada38786-1ec9-4e31-bfd5-1271ae5e28ab

📥 Commits

Reviewing files that changed from the base of the PR and between 6982d5b and 816fdd0.

⛔ Files ignored due to path filters (1)
  • src/invocation-plane-services/grpc-proxy/go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • src/invocation-plane-services/grpc-proxy/BUILD.bazel
  • src/invocation-plane-services/grpc-proxy/go.mod
  • src/invocation-plane-services/grpc-proxy/proxy/BUILD.bazel
  • src/invocation-plane-services/grpc-proxy/proxy/h2.go
  • src/invocation-plane-services/grpc-proxy/proxy/info_test.go
  • tools/scripts/test/test-workspace-status.sh
  • tools/workspace_status.sh

@priyaselvaganesan

Copy link
Copy Markdown
Contributor Author

Responses to the two nitpick comments from the review.

proxy/h2.go:45-46 (observability coverage for /info):
Confirmed, the shared middleware covers /info. createHttp2Server wraps the full mux with middleware.ApplyMiddleware, which composes otelhttp.NewMiddleware (inbound span and HTTP server metrics) with httplog zap request logging, and a MeterProvider is set in proxy/metrics/metrics.go. So /info gets the same spans, RED metrics, and structured logs as the proxied traffic, and keeps the shared instrumentation.

proxy/info_test.go:55-65 (build-time metadata contract):
The Service, Version, and GitHash x_defs are linker -X flags applied by bazel build --stamp, not by go test. Under go test the vars are empty and the handler returns unknown, so this test asserts field presence. The stamp mapping is a build and link concern. It is verified by the --stamp build and a local deploy, where /info returned service=nvcf-grpc-proxy and the full commit SHA. A go test that set the vars by hand would only re-cover the handler logic that go-lib's handler_test.go already tests, and would not catch a wrong x_def key. Keeping the presence checks, same as helm-reval #275.

@balajinvda balajinvda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@priyaselvaganesan
priyaselvaganesan added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 6a53555 Aug 5, 2026
18 checks passed
@priyaselvaganesan
priyaselvaganesan deleted the feat/version-endpoint-grpc-proxy branch August 5, 2026 17:26
@balajinvda

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version nvcf-grpc-proxy-v1.32.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants